using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Templates_AllIssuesTemplate : BaseTemplate
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Master.SetTopicTitle("All Issues");
        }
    }

    protected void dlArticles_PageIndexChanged(object sender, EventArgs e)
    {
        ((Acms.WebControls.AcmsDataList)sender).SelectedIndex = 0;
    }

    protected void dlArticles_ItemCreated(object sender, Acms.WebControls.AcmsDataListItemEventArgs e)
    {
        if (e.Item.IsNormalItem)
        {
            /*ReserveSocietyControls.ProgressControl rsProgress = e.Item.FindControl("rsProgress") as ReserveSocietyControls.ProgressControl;
            if (rsProgress != null && e.Item.AjaxPanel != null)
            {
                rsProgress.AssociatedUpdatePanelID = e.Item.AjaxPanel.ID;
            }
            UpdateProgress progress = e.Item.FindControl("progress") as UpdateProgress;
            if (progress != null && e.Item.AjaxPanel != null)
            {
                progress.AssociatedUpdatePanelID = e.Item.AjaxPanel.ID;
            }*/
            ReserveSocietyControls.ImageProgressControlExtender rsProgress = e.Item.FindControl("rsProgress") as ReserveSocietyControls.ImageProgressControlExtender;
            if (rsProgress != null)
            {
                rsProgress.AssociatedUpdatePanelId = e.Item.AjaxPanel.ID;
            }
        }
    }

    protected void dsPosts_SelectData(object sender, Acms.DataControls.SelectEventArgs<Acms.Bll.Post> e)
    {
        int topicId = (int)dlTopics.DataKeys[dlTopics.SelectedIndex]["Id"];
        int totalRecords = 0;
        System.Collections.Generic.List<Acms.Bll.Post> tmp = Acms.Bll.Post.GetAllByParentIdAndTopicId(CurrentPost.ParentId.Value, topicId, true, e.StartRowIndex, e.MaximumRecords, ref totalRecords);
        e.SetData(tmp, totalRecords);
    }

    protected void dsTopics_SelectData(object sender, Acms.DataControls.SelectEventArgs<Acms.Bll.Topic> e)
    {
        e.SetData(Acms.Bll.Topic.GetAllBySiteId(CurrentSiteId));
    }
    protected void dlTopics_ItemDataBound(object sender, Acms.WebControls.AcmsDataListItemEventArgs e)
    {
        if (e.Item.IsSelectedItem)
        {
            Master.SetTopic(e.Item.DataItem as Acms.Bll.Topic);
        }
    }
}
